*******************************************************************************
* This .do file reworks the replication .do file for Vreeland and Dreher (2014)
*******************************************************************************
*This file is used in replicating findings for "Foreign Aid Funnel? Placebo-Based 
*Assessment of Aid Flows to  Non-Permanent U.N. Security Council Members" by 
*Evangeline Reynolds (University of Illinois) and Matthew Winters (University of Illinois). 


log using ".\100CodeRecords\08_VreelandAndDreherExactReplication.log", replace

*capture log close
set more off
version 11.0
drop _all
clear matrix
clear mata
set mem 2000m
set mat 800

use ".\01VreelandAndDreher\VreelandAndDreherChapter5.dta", clear

xtset

*******************************************************************************************************************************************
******************************************************** Regressions **********************************************************************
*******************************************************************************************************************************************

/*
List of tables produced below: 
Chapter 5
	Table 5.1: "Bilateral"
	Table 5.2: "Bilateral Africa"
	Table 5.3: "World Bank"
	Table 5.4: "United Nations"
	Table 5.5: "United Nations AFRICA"
	Table 5.6: "AfDB"
	Table 5.7: "Swing Voter"
	Appendix 5.a1: "Descriptive Statistics"
	Figure 5.1 Bilateral development aid to UNSC members and non-UNSC members
*/

*********************************************************************************************************************
********************** 5.1- 5.5 *************************************************************************************
*********************************************************************************************************************

/*
	Table 5.1: "Bilateral"
	Table 5.2: "Bilateral Africa"
	Table 5.3: "World Bank"
	Table 5.4: "United Nations"
	Table 5.5: "United Nations AFRICA"
*/

local controls pariah war rgdpl2_ln polity2new milit_aid_ln ydumREP* cotrendregREP* egytrendREP 	
local SubsetGlobal hic~=1 & code~="CHN" & code~="RUS" & year>1959
local SubsetAfrica africa==1 & hic~=1 & code~="CHN" & code~="RUS" & year>1959

local OutcomeVariables odadisUSA_ln odadisJPN_ln odadisDEU_ln odadisGBR_ln odadisFRA_ln /*5.1 & 5.2 "Bilateral" */ ///
                        aiddisIBRD_ln  aiddisIDA_ln  /* 5.3 "World Bank" */   ///
					   odadisUN_ln odadisWFP_ln odadisUNDP_ln odadisUNICEF_ln odadisUNHCR_ln odadisUNTA_ln /* 5.4 & 5.5 "UN" */ 
					   
foreach x of varlist `OutcomeVariables'{

display `x'

		*Straight unsc
		xtreg 	`x' unsc `controls' 	///
				if `SubsetGlobal', cluster(code) fe
		 

		*Partitioned - SC partitioned by importance
		xtreg 	`x' unsc0 unsc1 unsc2 `controls' 	///
				if `SubsetGlobal', cluster(code) fe level(90)
		
				
		*Africa Subset - Straight unsc
		xtreg 	`x' unsc `controls' 	///
				if `SubsetAfrica', cluster(code) fe
		 
		
		*Africa Subset - SC partitioned by importance
		xtreg 	`x' unsc0 unsc1 unsc2 `controls' 	///
				if `SubsetAfrica', cluster(code) fe level (90)
		 
}

log close








